<script>
    var max = 24
    var min = 12
    for(var i =min; i>=1; i--){
        if(max % i == 0 && min % i == 0){
            console.log(i)
            break
        }
    }
</script>